import { ref } from "vue";

const counter = (n) => {
  // 如果希望数据有响应式，定义需要加ref
  const count = ref(n);
  const add = () => {
    // console.log(count);
    count.value++;
  };
  const minus = () => {
    // console.log(count);
    count.value--;
  };

  return [count, add, minus];
};

export default counter;
